#ifndef _IPCUTY_H
#define _IPCUTY_H

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <unistd.h>

#ifdef __cplusplus
extern "C" {
#endif

extern char g_sem_path[];
extern int  g_sem_item;

union semun {
	int				val;
	struct semid_ds *buf;
	unsigned short	*array;
};

int		sem_create_u();
int		sem_get_u();
int		sem_create(char filepath[], int itemid);	// create a new SEM & init su.val to 1
int		sem_get(char filepath[], int itemid);		// get an existed SEM
int		sem_v(int semid);
int		sem_p(int semid);
//int		sem_v2(int semid);
//int		sem_p2(int semid);
int		sem_destroy(int semid);

/*
int		shm_create(char filepath[], int itemid, size_t size);
int 	shm_get(char filepath[], int itemid);
int		shm_destroy(int shmid);
*/

#ifdef __cplusplus
}
#endif

#endif
